using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace MSTestExtensions
{
    /// <remarks>
    /// <para>
    /// Use to declare an expected Exception with a specific message.
    /// </para>
    /// <para>
    /// The MSTest attribute of <see cref="ExpectedExceptionAttribute"/> has the 
    /// property <see cref="ExpectedExceptionAttribute.Message"/> but this does not
    /// specify the expected Exception message but the message to be logged to the 
    /// test output.
    /// </para>
    /// </remarks>
    [AttributeUsage(AttributeTargets.Method)]
    public sealed class ExpectedExceptionMessageAttribute : Attribute
    {
        #region Constructors

        /// <remarks />
        public ExpectedExceptionMessageAttribute(Type exceptionType, string exceptionMessage)
        {
            _exceptionType = exceptionType;
            _exceptionMessage = exceptionMessage;
        }

        #endregion // Constructors

        #region Fields

        /// <remarks />
        private Type _exceptionType;

        /// <remarks />
        private string _exceptionMessage;

        #endregion // Fields

        #region Properties

        /// <remarks />
        public Type ExceptionType
        {
            get { return _exceptionType; }
        }

        /// <remarks />
        public string ExceptionMessage
        {
            get { return _exceptionMessage; }
        }

        #endregion // Properties
    }
}
